package com.jar.netty_demo.Netty.http;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) {
        ChannelPipeline pipeline = ch.pipeline();
        //向pipeline中加入解码器
        pipeline.addLast("decode", new HttpServerCodec());
        //向pipeline中加入编码器
        //加入自己的业务处理
        pipeline.addLast("myHttpServerHandler", new HttpServerHandler());
        pipeline.addLast("myHttpServerHandlerSecond", new HttpServerHandlerSecond());

    }

}
